import psutil

# 获取CPU使用率
cpu_usage = psutil.cpu_percent(interval=1)  # 每秒钟采样一次，可以根据需要调整间隔

# 获取内存使用率
memory_usage = psutil.virtual_memory().percent

print(f"CPU使用率：{cpu_usage}%")
print(f"内存使用率：{memory_usage}%")


from tools.remove_temp_file import remove_path
import os


flag__remove_dirs = 1
if flag__remove_dirs:
    # remove_dir_ls = ['videos', 'runs']
    remove_dir_ls = ['runs']
    assert isinstance(remove_dir_ls, list), 'remove_dir_ls必须为list类型!'
    for remove_dir in remove_dir_ls:
        if os.path.exists(remove_dir):
            remove_path(remove_dir, keep_external_folder=True)
